﻿<?php 
if($words==null){
?>
<tr>
                        <td >
							Không có dữ liệu
                        </td>
                        <td>
                           Không có dữ liệu
                        </td>
                         <td>
                         	Không có dữ liệu	
                        </td>
                        
                        <td>
                            Không có dữ liệu
                        </td>
                    </tr>
<?php
}else{
foreach($words as $term){
?>
                    <tr>
                        <td >
							<a href="<?php echo Base_url_TuDien.'/'.$lang.'/'.$term['word'];?>" title="Tìm từ : <?php echo $term['word'];?>"><?php echo $term['word'];?></a>
                        </td>
                        <td>
                            <?php 
							
							$s = '19/11/2014';
							$date = strtotime($s);
							$date = date('d/M/Y', $date);
							if($term["dateInsert"] < $date){
								design($term["MeanWord"],$lang,$wordSearch);
							}else{
								echo $term["MeanWord"];
							}
?>	
                        </td>
                         <td>
                         	<a href="https://www.google.com/search?site=&tbm=isch&source=hp&biw=1366&bih=648&q=<?php echo $term['word'];?>" title="Tìm từ : '<?php echo $term['word'];?>'  với ảnh" target="_blank"><?php echo $term['word'];?></a>
                        		
                        </td>
                        
                        <td>
                            <?php echo $term['userID'];?>
                        </td>
                    </tr>
<?php
}
}
function design($WordMean,$lang,$wordSearch){
	$WordMean = preg_replace('/=/','</h1><br />----- -----Cách dùng :=',$WordMean,1);
	$WordMean = str_replace('=','<br /><b style="color: rgb(0, 238, 152);"> * </b>',$WordMean);
	$WordMean = preg_replace('/----- -----/',"<div class='style1'>",$WordMean,1);
	$WordMean = preg_replace('/@/','',$WordMean,1);/// das Leben	
	
	$WordMean = preg_replace('/-/','<h1> -',$WordMean,1);// thay cho Hr
	$WordMean = str_replace('- {','</span> <br/><span class="span1" >- {',$WordMean);
	echo trim($WordMean);
	echo "</div>";
	if(substr_count($WordMean, "\n" )>3){
		//echo '<div class="show-more"><a href="'.Base_url_TuDien.'/'.$lang.'/'.$wordSearch.'#D">Show more</a></div>';
	}
}

function getUrl() {
  $url  = @( $_SERVER["HTTPS"] != 'on' ) ? 'http://'.$_SERVER["SERVER_NAME"] :  'https://'.$_SERVER["SERVER_NAME"];
  $url .= ( $_SERVER["SERVER_PORT"] !== 80 ) ? ":".$_SERVER["SERVER_PORT"] : "";
  $url .= $_SERVER["REQUEST_URI"];
  return $url;
}
?>
                </table>
            </div>